package com.petalsgroup.petals.service.admin.impl;

import com.petalsgroup.petals.dao.admin.AdminDao;
import com.petalsgroup.petals.dao.admin.impl.AdminDaoImpl;

import com.petalsgroup.petals.pojo.AdministratorDO;
import com.petalsgroup.petals.pojo.CommentsDO;
import com.petalsgroup.petals.pojo.UserDO;
import com.petalsgroup.petals.service.admin.AdminService;
import com.petalsgroup.petals.util.LimitUtil;
import com.petalsgroup.petals.util.MailUtils;

import java.util.List;

public class AdminServiceIpml implements AdminService {
    AdminDao ad=new AdminDaoImpl();

    /**
     * 管理员登陆，根据账号密码确定是否存在该管理员
     * @param admin
     * @author wgd
     * @return
     */
    @Override
    public AdministratorDO login(AdministratorDO admin) {
        AdministratorDO loginAdmin=ad.findAdminByUsernameAndPassword(admin.getUsername(),admin.getPassword());
        if (loginAdmin !=null){
            return loginAdmin;
        }else{
            return null;
        }
    }

    /**
     * 获取用户信息列表
     * @author wgd
     * @return
     */
    @Override
    public List<UserDO> findAll() {
        List<UserDO> list = ad.selectAllUser();
        return list;
    }



}
